package hongvt.quanlynhanvien.utils;

import android.util.Log;

public class MyLog {
	private static final int maxLogSize = 1000;
	private static boolean LOG_IS_ACCESSED = true;

	public static void v(String tag, String message) {
		if (LOG_IS_ACCESSED) {
			for (int i = 0; i <= message.length() / maxLogSize; i++) {
				int start = i * maxLogSize;
				int end = (i + 1) * maxLogSize;
				end = end > message.length() ? message.length() : end;
				Log.v(tag, message.substring(start, end));
			}
		}
	}

	public static void e(String tag, String message) {
		if (LOG_IS_ACCESSED) {
			for (int i = 0; i <= message.length() / maxLogSize; i++) {
				int start = i * maxLogSize;
				int end = (i + 1) * maxLogSize;
				end = end > message.length() ? message.length() : end;
				Log.e(tag, message.substring(start, end));
			}
		}
	}

	public static void d(String tag, String message) {
		if (LOG_IS_ACCESSED) {
			for (int i = 0; i <= message.length() / maxLogSize; i++) {
				int start = i * maxLogSize;
				int end = (i + 1) * maxLogSize;
				end = end > message.length() ? message.length() : end;
				Log.d(tag, message.substring(start, end));
			}
		}
	}

	public static void i(String tag, String message) {
		if (LOG_IS_ACCESSED) {
			for (int i = 0; i <= message.length() / maxLogSize; i++) {
				int start = i * maxLogSize;
				int end = (i + 1) * maxLogSize;
				end = end > message.length() ? message.length() : end;
				Log.i(tag, message.substring(start, end));
			}
		}
	}

}
